import Vue from 'vue'
import Router from 'vue-router'

import Login from '@/views/login' //登陆
import Business from '@/views/selectBusiness' //选择企业
import Layout from '@/views/layout' //layout  tabbar
import Home from '@/views/home' //首页
import Order from '@/views/order' //订单页
import Mine from '@/views/mine' //我的页面
import Reserve from '@/views/reserve' //预定页面

Vue.use(Router)

const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err)
}

export default new Router({
    routes: [{
        path: '/',
        name: 'login',
        component: Login
    }, {
        path: '/business',
        name: 'Business',
        component: Business
    }, {
        path: '/',
        name: 'layout',
        component: Layout,
        children: [{
            path: '/home',
            name: 'home',
            component: Home
        }, {
            path: '/order',
            name: 'order',
            component: Order
        }, {
            path: '/mine',
            name: 'mine',
            component: Mine
        }]
    }, {
        path: '/reserve',
        name: 'reserve',
        component: Reserve
    }]
})